fn main() {
    let s1 = Student {
        id: 1,
        name: String::from("jinghua.wang"),
        age: 33,
        email: String::from("jinghua.wang@163.com"),
        is_male: true,
        weight: 54.3,
    };

    let s2 = Student {
        id: 2,
        name: String::from("liufeng.bo"),
        email: String::from("liufeng.bo@163.com"),
        ..s1
    };

    println!("{:#?}", s2);
    let w1 = 30;
    let h1 = 50;

    let sq = area(w1, h1);
    println!("{}", sq);

    let r1 = Rectangle{
        width: 30,
        height: 50,
    };
    println!("{:?}", r1);

    let sqr = area_rec(&r1);
    println!("{}", sqr);
}

#[derive(Debug)]
#[allow(dead_code)]
struct Student {
    id: i32,
    name: String,
    age: u32,
    email: String,
    is_male: bool,
    weight: f64,
    // userid: &str
    // compile error E0106
}

#[derive(Debug)]
struct Rectangle{
    width: u32,
    height: u32,
}

fn area(wid: u32, height: u32)->u32{
    wid*height
}

fn area_rec(rec: &Rectangle)->u32{
    &rec.height * &rec.width
}
